home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue29 / afpelog / AFPELOG.ZIP / afpevlog.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-10-08  |  1.5 KB  |  64 lines

  1. unit afpevlog;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, afpEventLog, ExtCtrls, Spin;
  8.  
  9. type
  10.   TEventLogDemo = class(TForm)
  11.     CreateLogEntryButton: TButton;
  12.     cb1: TCheckBox;
  13.     afpEventLog1: TafpEventLog;
  14.     LogMsgEdit: TEdit;
  15.     CloseButton: TButton;
  16.     Label1: TLabel;
  17.     AppnameEdit: TEdit;
  18.     Label2: TLabel;
  19.     rg1: TRadioGroup;
  20.     cb2: TCheckBox;
  21.     se1: TSpinEdit;
  22.     se2: TSpinEdit;
  23.     Label3: TLabel;
  24.     Label4: TLabel;
  25.     procedure CreateLogEntryButtonClick(Sender: TObject);
  26.     procedure CloseButtonClick(Sender: TObject);
  27.   private
  28.     { Private declarations }
  29.   public
  30.     { Public declarations }
  31.   end;
  32.  
  33. var
  34.   EventLogDemo: TEventLogDemo;
  35.  
  36. implementation
  37.  
  38. {$R *.DFM}
  39.  
  40. procedure TEventLogDemo.CreateLogEntryButtonClick(Sender: TObject);
  41.  
  42. begin
  43.     case rg1.ItemIndex of
  44.       0:    afpEventLog1.EventType := etError;
  45.         1:    afpEventLog1.EventType := etWarning;
  46.         2:    afpEventLog1.EventType := etInformation;
  47.       3:    afpEventLog1.EventType := etAuditSuccess;
  48.         4:    afpEventLog1.EventType := etAuditFailure;
  49.   end;
  50.   afpEventLog1.IncludeUserName :=cb1.Checked;
  51.   afpEventLog1.RegisterApplication :=cb2.Checked;
  52.     afpEventLog1.EventCategory := se1.Value;
  53.   afpEventLog1.EventID := se2.Value;
  54.   afpEventLog1.ApplicationName := AppnameEdit.Text;
  55.   afpEventLog1.LogEvent(LogMsgEdit.Text+#13#10'Contact support!');
  56. end;
  57.  
  58. procedure TEventLogDemo.CloseButtonClick(Sender: TObject);
  59. begin
  60.     Close;
  61. end;
  62.  
  63. end.
  64.